<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订单退货申请</title>
</head>
<script src="../static/global.js"></script>
<body>

<!-- 查询订单-->
<div style="margin-top: 20px">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">订单编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="order_sn_sousuo" id="order_sn_sousuo" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">用户名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="member_username_sousuo" id="member_username_sousuo" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button type="submit" class="layui-btn" id="order_souso" lay-submit="" lay-filter="demo1">查询</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<!--表格渲染-->
<table class="layui-hide" id="demo" lay-filter="test"></table>


<script>
    layui.use(['form', 'table', 'layer'], function () {
        let form = layui.form;
        let table = layui.table;
        let layer = layui.layer;
        let $ = layui.$;

        table.render({
            elem: '#demo',
            url: glodate.serverZuul + 'order_return_apply/find_admin_order_return_apply_All', //数据接口
            toolbar: '#toolbarDemo', //开启工具栏
            page: true,//开启分页
            cols: [[
                {type: 'checkbox', fixed: 'left'},
                {field: 'order_id', title: '订单编号'},
                {field: 'sku_id', title: '退货商品ID'},
                {field: 'order_sn', title: '订单编号'},
                {field: 'create_time', title: '申请时间'},
                {field: 'member_username', title: '会员用户'},
                {field: 'return_amount', title: '退款金额'},
                {field: 'return_name', title: '退款人姓名'},
                {field: 'return_phone', title: '退款人电话'},
                {
                    field: 'status', title: '申请状态', templet:
                        function (d) {
                            if (d.status == 0) {
                                return '<span class="layui-badge-rim">待处理</span>'
                            } else if (d.status == 1) {
                                return '<span class="layui-badge layui-bg-orange">退货中</span>'
                            } else if (d.status == 2) {
                                return '<span class="layui-badge layui-bg-gray">已完成</span>'
                            } else if (d.status == 3) {
                                return '<span class="layui-badge layui-bg-blue">已拒绝</span>'
                            }
                        }
                },
                {field: 'sku_img', title: '商品图片'},
                {field: 'sku_name', title: '商品名称'},
                {field: 'sku_brand', title: '商品品牌'},
                {field: 'reason', title: '原因'},
                {field: 'handle_man', title: '处理人员'},
                {fixed: 'right', align: 'center', toolbar: '#barDemo'}
            ]], id: 'tableID'
        })

        //模糊查询
        $("#order_souso").on('click', function () {
            active.reload();
            return false;
        });

        active = {
            reload: function () {
                table.reload('tableID', {
                    where: {
                        'order_sn': $("#order_sn_sousuo").val(),
                        'member_username': $("#member_username_sousuo").val()
                    }, page: {
                        curr: 1
                    }
                })
            }
        }

        //提取的清除表单的方法  formId form表头的id值
        function formIdreset(formId) {
            // 重置清空
            $(formId)[0].reset();
            form.render();//必须写
        }

    });
</script>

</body>
</html>